package com.neusoft.databus.core.service;

import java.util.List;
import java.util.Map;

import javax.servlet.http.HttpServletResponse;

import org.apache.poi.xssf.streaming.SXSSFWorkbook;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
import org.springframework.web.multipart.MultipartFile;

import com.neusoft.bizcore.web.dto.result.ResultDTO;
import com.neusoft.bizcore.web.support.Searchable;
import com.neusoft.databus.common.bean.CommandBean;
import com.neusoft.databus.common.dto.ResourceDTO;

/**
 * description
 *
 * @author sunchf
 * @date 2018年12月21日 下午4:25:46
 */
public interface ResourceService {

    ResourceDTO findById(long id);

    ResourceDTO findByCode(String code);

    boolean isExisted(String code);

    List<ResourceDTO> findByGateway(String gatewayCode);

    List<ResourceDTO> search(Searchable searchable);

    Page<ResourceDTO> search(Pageable pageable, Searchable searchable);

    ResourceDTO create(ResourceDTO dto);

    ResourceDTO update(String code, ResourceDTO dto);

    ResourceDTO bind(Long id, List<Long> groupIdList);

    ResourceDTO bind(String code, List<String> groupCodeList);

    void delete(String code);

    void enable(String code);

    void disable(String code);

    ResultDTO<CommandBean> collect(String code) throws Exception;

    ResultDTO<CommandBean> collect(String code, Map<String, Object> params) throws Exception;

    ResultDTO<CommandBean> control(String code, String metric) throws Exception;

    ResourceDTO findByAssociate(String associate);

    void importTpl(MultipartFile excel);

    Map<String, List<Long>> distribution();

    SXSSFWorkbook getTpl();

    void export(final Searchable searchable, final Pageable pageable, final HttpServletResponse response);

    List<ResourceDTO> findCollectedResources();
}
